package com.csun.cmny.provider.service;

import com.csun.cmny.base.dto.LoginAuthDto;
import com.csun.cmny.core.support.IService;
import com.csun.cmny.provider.dto.OmcOldLeaveQueryDto;
import com.csun.cmny.provider.model.dto.old_leave.OldLeaveOldmanQueryDto;
import com.csun.cmny.provider.model.vo.old_leave.OldLeaveOldmanVo;
import com.csun.cmny.provider.pojo.OmcOldLeave;
import com.csun.cmny.provider.vo.OldLeaveVo;
import com.csun.cmny.provider.vo.OldUnLeaveVo;
import com.csun.cmny.provider.vo.OmcAdjustRefundData;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * @author chenzheng
 * @description:
 * @date 2019/7/22 14:11
 */
public interface OmcOldLeaveService extends IService<OmcOldLeave> {
    //保存或者跟新老人请假日志
    int saveOmcOldLeave(OmcOldLeave omcOldLeave, LoginAuthDto loginAuthDto);

    //根据ID查询请假记录
    OldLeaveVo showById(@Param("id") Long id);

    //根据老人ID和老人姓名查询所有的请假记录
    List<OldLeaveVo> showAll(OmcOldLeaveQueryDto omcOldLeaveQueryDto);

    //根据老人姓名查询该班组老人信息
    List<OldUnLeaveVo> selectOldManByName(OmcOldLeaveQueryDto omcOldLeaveQueryDto);

    /**
     * 调房调级--查询老人上个周期账单执行时间至调房调级的时间间的未退费的请假和退费金额
     * @param omcOldLeaveQueryDto
     * @return
     */
    OmcAdjustRefundData showLeaveRefundFee(OmcOldLeaveQueryDto omcOldLeaveQueryDto);
    /**
     * 根据机构,老人ID,时间范围,查询机构老人的请假信息
     * @param paramMap
     * @return
     */
    List<OmcOldLeave> selectOldLeaveList(Map<String,Object> paramMap);

    /**
     *  根据机构,老人ID,时间范围,查询机构老人的请假退费周期数
     * @param paramMap
     * @return
     */
    BigDecimal selectReturnDegree(Map<String,Object> paramMap);

    /**
     * 查看老人是否在请假中
     * @param omcOldLeave
     * @return
     */
    int confirmLeave(OmcOldLeave omcOldLeave);

    /**
     * 计算退费天数
     * @param groupId 机构ID
     * @param days    实际请假天数
     * @return
     */
    int getRefundDays(Long groupId,int days);

    /**
     * 批量更新请假信息
     * @param list
     * @return
     */
    int batchUpdate(List<OmcOldLeave> list);

    /**
     * 计算请假退费费用
     * @param omcOldLeave
     * @return
     */
    OmcOldLeave calculateRefundFee(OmcOldLeave omcOldLeave,LoginAuthDto loginAuthDto);

    /**
     * 查询可以进行请假的老人
     *
     * @param oldLeaveOldmanQueryDto    the old leave oldman query dto
     *
     * @return  the old leave oldman vo
     */
    List<OldLeaveOldmanVo> queryOldmanList(OldLeaveOldmanQueryDto oldLeaveOldmanQueryDto);

    /**
     * 查询请假日期在请假日期和回院日期之间的记录数量
     *
     * @param leaveDate the leave date
     *
     * @return  the int
     */
    int queryCountByLeaveDate(Long oldmanId, String leaveDate);

    /**
     * 根据日期结算请假退费费用
     *
     * @param date
     *
     * @return
     */
    int closeReturnFeeByDate(Integer oldmanId, String date);

    /**
     * 查询今天请假老人的请假详情
     * @param groupId
     * @return
     */
    List<OldLeaveOldmanVo> selectLeaveOldMan(Long groupId);
}
